//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _UIERROR_H
#define _UIERROR_H
//
#include <QString>
//
class UiError : public QString {
   //data
   bool displayed;
   mutable bool copied;
public:
   //construction
   inline UiError() : QString(), displayed(false), copied(false) {}
   inline UiError(const QString& errorText) : QString(errorText), displayed(false), copied(false) {}
   //copying
   inline UiError(const UiError &other) : QString(other), displayed(other.displayed), copied(false) {
      other.copied = true;
   }
   inline UiError &operator=(const UiError &other) {
      QString::operator=(other);
      displayed = other.displayed;
      other.copied = true;
      return *this;
   }
   //destruction
   ~UiError();
   //query and set functions
   inline bool failed() const {
      return !isEmpty();
   }
   inline bool success() const {
      return isEmpty();
   }
   inline bool is_displayed() const {
      return displayed;
   }
   inline void mark_as_displayed() {
      displayed = true;
   }
};
#endif /* _UIERROR_H */

